package cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.service;

import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.entity.Patent;
import cn.edu.sdjzu.xg.eagle.xg23_kcsj_01.mapper.PatentMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PatentService {
    @Autowired
    private PatentMapper patentMapper;
    public boolean addPatent(Patent patent) {
        return patentMapper.addPatent(patent);
    }

    public boolean deletePatent(String patentNo) {
        return patentMapper.deletePatent(patentNo);
    }

    public boolean updatePatent(Patent patent) {
        return patentMapper.updatePatent(patent);
    }


    public PageInfo<Patent> selectPatentsByCondition(Integer pageNum, Integer pageSize, Patent patent) {
        PageHelper.startPage(pageNum, pageSize);
        List<Patent> patentList = patentMapper.selectPatentsByCondition(patent);

        return new PageInfo<>(patentList);
    }
}
